<template>
  <div class="cq-header">
    <div class="cq-head-wrap w1160 flex flex-between">
      <div class="cq-head-logo">
        <h1>
          <span class="visib-hid">橙子</span>
          <a href="#">
            <img
              src="@/assets/img/logo-rev.png"
              width="92"
              height="36"
              alt="logo"
            />
          </a>
        </h1>
      </div>
      <div class="cq-head-nav flex">
        <ul class="flex">
          <li
            v-for="item in navList"
            :key="item.linkName"
            :class="{ 'pull-list': item.children && item.children.length }"
          >
            <div v-if="item.children && item.children.length">
              <a href="#" class="icon pr10 icon-arrow-down flex flex-center">{{
                item.linkName
              }}</a>
              <ul class="pull-list-item">
                <li v-for="i in item.children" :key="i.linkName">
                  <a href="#">{{ i.linkName }}</a>
                </li>
              </ul>
            </div>
            <a href="#" v-else>{{ item.linkName }}</a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'cq-header',
  data () {
    return {
      navList: [
        {
          url: '#',
          linkName: '首页'
        },
        {
          url: '#',
          linkName: '橙品牌',
          children: [
            {
              url: '#',
              linkName: '橙金融'
            },
            {
              url: '#',
              linkName: '橙积分'
            }
          ]
        },
        {
          url: '#',
          linkName: '橙金融'
        },
        {
          url: '#',
          linkName: '橙积分'
        },
        {
          url: '#',
          linkName: '橙品牌'
        }
      ]
    }
  }
}
</script>

<style lang="scss" scoped>
.cq-header {
  position: fixed;
  z-index: 9999;
  width: 100%;
  top: 0;
  left: 0;
}

.cq-head-wrap {
  height: 36px;
  padding: 22px 0;
}

.cq-head-nav a {
  color: #c8c8c8;
  font-size: 16px;
  line-height: 36px;
  margin-right: 46px;
}

.cq-head-nav a:hover {
  color: #fff;
  text-decoration: none;
}

.pull-list {
  position: relative;
}

.pull-list-item {
  overflow: hidden;
  position: absolute;
  top: 58px;
  left: -30px;
  visibility: hidden;
  max-height: 0;
  width: 124px;
  line-height: 44px;
  background-color: rgba(0, 0, 0, 0.3);
  text-align: center;
  transition: 0.3s;
  border-radius: 4px;
}

.pull-list-item a {
  margin: 0;
  color: #fff;
}

.pull-list-item a:hover {
  color: #ff7200;
}

.pull-list:hover .pull-list-item {
  visibility: visible;
  max-height: 500px;
}

.pull-list:hover .icon-arrow-down::after {
  transform: rotate(180deg);
}
</style>
